package com.briup.gsauestore.dao;

import com.briup.gsauestore.bean.Order;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;
import java.util.List;

/**
 * @author adam
 * @date  2022/1/12
 */
@Repository
public interface IOrderDao extends JpaRepository<Order, String> {

    @Modifying
    @Transactional
    @Query(nativeQuery = true,value = "update t_order set status =?1 where id=?2")
    void  updateStatusById(int status,String id);


    List<Order>  findByUserId(long userId);
}
